package com.atguigu.day16.test04;

import java.util.Arrays;

/**
 * @author fenge
 */
public class Test04 {
    public static void main(String[] args) {
        Integer[] i = new Integer[]{1, 3, 4};
        reverse(i);
        System.out.println(Arrays.toString(i));
        String[] j = {"jalshdajs", "adsjldhas"};
        reverse(j);
        System.out.println(Arrays.toString(j));
    }

    public static <T> void reverse(T[] arr) {
        for (int i = 0; i < arr.length / 2; i++) {
            T temp = arr[i];
            arr[i] = arr[arr.length - 1 - i];
            arr[arr.length - 1 - i] = temp;
        }
    }
}

